# To change this template, choose Tools | Templates
# and open the template in the editor.

__author__="yangqibin"
__date__ ="$Nov 13, 2011 4:46:57 AM$"

import web
import res_code

db = web.database(dbn='mysql', db='blog', user='yangqibin', passwd='yangqibin', charset='utf8')

def register(username, password, email):

    db_res = db.select('member', where='username=$username', var=locals())

    if not db_res:
        try:
            db_res = db.query("call sp_register($username, $password, $email);")

            if not db_res:
                return res_code.err_db
            else:
                return db_res[0].ret
        except:
            return res_code.err_unknown

if __name__ == "__main__":
    print "Hello World"
